package file;

import java.io.File;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        /*
        for (int i = 0; i < 100; i++) {
            File file = new File("file" + i + ".txt");
            if (file.exists()) {
                System.out.println("文件已存在");
            } else {
                file.createNewFile();
                System.out.println(file.getName()+"以创建");
            }
        }

         */
        for (int i = 0; i < 100; i++) {
            File file = new File("file" + i + ".txt");
            if (file.exists()) {
                file.delete();
                System.out.println(file.getName() + "已删除");
            } else {
                System.out.println("文件不存在");
            }
        }
    }
}
